/******************************************************************************************
 * Import
 ******************************************************************************************/
import _ from 'lodash';
import React, {Component} from 'react';
import Design from '../design';
import Config from '../config';
import ScreenBase from '../library/base/screen';
// import SplashScreen from 'react-native-splash-screen';
import {
    CAround, CBetween, CCenter, CColumn, CHand, CItemX, CItemY, CLine, CRow, CWrap, 
    CIcon, CImage, CSvg, CText,
    CContent, CFloat, CFooter, CHeader, CPage, CSide, 
    CEmpty, CError, CFail, CSkeleton, 
    CLabel, CButton
} from '../library/comp';
import {
    HttpText, HttpHesq
} from '../library/func';

/******************************************************************************************
 * Restful
 ******************************************************************************************/
const restful = {
    cacheload() {
        return {
            key: 'preload_testcache',
            isEmpty: (data)=> {
                if (_.isEmpty(data)) return true;
                return false;
            }
        };
    }
};

/******************************************************************************************
 * Screen
 ******************************************************************************************/
 export default class Test extends ScreenBase {

    /*------------------------------------------------------------------------------------
	 * 初始化
	 *-----------------------------------------------------------------------------------*/
	constructor(props) {
        super(props);
        super(props, restful);
        this.state = {
            screen: this.screenLoad,
            data: ''
        }
        // console.log(this.state)
        // this.init();
    }
    
    /*------------------------------------------------------------------------------------
	 * 生命周期
	 *-----------------------------------------------------------------------------------*/
    /**
     * didMount
     */
    componentDidMount(){
        this.cacheload();

    }

	/*------------------------------------------------------------------------------------
	 * 渲染
	 *-----------------------------------------------------------------------------------*/
    // 空数据渲染
    screenEmpty() {
        return (
            <CContent bg='#ddd' my='60'>
                <CText>空数据</CText>
            </CContent>
        );
    }

    // 成功时的渲染
    screenSuccess() {
        return (
            <CContent bg='#ddd' my='60'>

                <CText>加载成功</CText>

            </CContent>
        );
    }

    // 总render
	render() {
        const Screen = this.state.screen.bind(this);
		return (
            <CPage>
                <Screen></Screen>
                <CHeader h='60' bg='#06f'>
                    <CLabel color='#f00' size='30'>Left</CLabel>
                    <CLabel color='#f00' size='30'>Center</CLabel>
                    <CLabel color='#f00' size='30'>Right</CLabel>
                </CHeader>
            </CPage>
		);
	}
}
